package com.simpleaccount.User;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.RadioButton;
import android.widget.Toast;

import com.simpleaccount.R;
import com.simpleaccount.SettingActivity;
import com.simpleaccount.Toast.ToastUtils;

import es.dmoral.toasty.Toasty;

/**
 * Created by Administrator on 2017/7/21.
 */

public class AdviceFeedbackActivity extends Activity implements View.OnClickListener{

    private RadioButton rbtn_Five;
    private RadioButton rbtn_Four;
    private RadioButton rbtn_Three;
    private RadioButton rbtn_Two;
    private RadioButton rbtn_One;
    private RadioButton rbtn_Zero;
    private Button btn_submit;


    @Override
    protected void onCreate(Bundle savedInstanceState) {//2
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_advicefeedback);
       //实例化RadioButton
        rbtn_Five=(RadioButton)findViewById(R.id.rbtn_Five);
        rbtn_Four=(RadioButton)findViewById(R.id.rbtn_Four);
        rbtn_Three=(RadioButton)findViewById(R.id.rbtn_Three);
        rbtn_Two=(RadioButton)findViewById(R.id.rbtn_Two);
        rbtn_One=(RadioButton)findViewById(R.id.rbtn_One);
        rbtn_Zero=(RadioButton)findViewById(R.id.rbtn_Zero);
        //实例化Button
        btn_submit=(Button)findViewById(R.id.btn_submit);

        btn_submit.setOnClickListener(AdviceFeedbackActivity.this);

    }


    @Override
    public void onClick(View v) {
        switch (v.getId()){//switch
            case R.id.btn_submit:
                if(rbtn_Zero.isChecked()||rbtn_One.isChecked()||rbtn_Two.isChecked()
                        ||rbtn_Three.isChecked()||rbtn_Four.isChecked()||rbtn_Five.isChecked()){
                ToastUtils.toast(AdviceFeedbackActivity.this,"答案已提交，谢谢您的反馈~","success");
                Intent intent_setting = new Intent(AdviceFeedbackActivity.this, SettingActivity.class);
                startActivity(intent_setting);
                finish();
                break;}
                else{
                    ToastUtils.toast(AdviceFeedbackActivity.this,"请选择后再提交","success");
            }
        }
    }

    @Override
    protected void onPause() {
        super.onPause();
        ToastUtils.cancel();
    }

    @Override
    protected void onStop() {
        super.onStop();
        ToastUtils.cancel();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        ToastUtils.cancel();
    }
}
